import prisma from '../../prisma/client'

const addInvoice = async (data: any) => {
  // console.log(data)
  await prisma.invoice.create({
    data
  })
}

const getInvoiceList = (data: any) => {
  if (data) {
    return prisma.invoice.findMany({
      where: data,
      include: {
        user: true
      }
    })
  } else {
    return prisma.invoice.findMany({
      include: {
        user: true
      }
    })
  }
}

export default {
  getInvoiceList,
  addInvoice
}
